package sugarbind_input

class Lectin_Support {

    String lectin_Support_Name
	
	
    static constraints = {
			lectin_Support_Name(nullable:false)
			
//			lectin_Support_Name(unique:true)
			lectin_Support_Name(unique:['agent','lectin_Support_Type'])
	}
	
	static hasOne = [lectin_Support_Type:Lectin_Support_Type, agent:Agent]
	static hasMany = [lectins: Lectin]
	
	
	static mapping = {
//		id column: 'agent_property_id'
		id generator: 'sequence', params: [sequence: 'lectin_support_id_seq']
	}
	
	public String toString(){
		def type = lectin_Support_Type.lectin_Support_Type_Name
		if(type.equals("Unknown"))
		{
			type += " type"
		}
		
		lectin_Support_Name+" (" + id +") / "+ type +", "+agent.getFullName()
	}
	
	public static listLectin_Supports()
	{
		Lectin_Support.list().sort{ it.toString(); }
	}
}
